package com.anda.jsu.yangsp.core.sys.mail;

import com.anda.jsu.yangsp.core.sys.logger.AndaLogger;
import com.anda.jsu.yangsp.core.sys.mail.bean.AndaMailSenderInfoBean;

/**
 * 
 * @author xiaolu
 * @since 2012-12-06
 *
 */
public class AndaMailSender {

	public static void sendMailToManagerAsText(String subject, String mailContent){
		try {
			// 这个类主要是设置邮件
			AndaMailSenderInfoBean mailInfo = new AndaMailSenderInfoBean();
			mailInfo.setMailServersHost("smtp.163.com");
			mailInfo.setMailServersPort("25");
			mailInfo.setValidate(true);
			mailInfo.setUserName("anda_notice@163.com");
			mailInfo.setSecurityWord("anda.notice");
			mailInfo.setFromMailAddress("anda_notice@163.com");
			mailInfo.setToMailAddress("417165765@qq.com");
			mailInfo.setMailSubject(subject);
			mailInfo.setMailContent(mailContent);
			// 这个类主要来发送邮件
			AndaSimpleMailSender.sendMailAsText(mailInfo);// 发送文体格式
		} catch (Exception e) {
			AndaLogger.recordLogger(e.getMessage());
		}
	}

	public static void sendMailToManagerAsHtml(String subject, String mailContent){
		try {
			// 这个类主要是设置邮件
			AndaMailSenderInfoBean mailInfo = new AndaMailSenderInfoBean();
			mailInfo.setMailServersHost("smtp.163.com");
			mailInfo.setMailServersPort("25");
			mailInfo.setValidate(true);
			mailInfo.setUserName("anda_notice@163.com");
			mailInfo.setSecurityWord("anda.notice");
			mailInfo.setFromMailAddress("anda_notice@163.com");
			mailInfo.setToMailAddress("417165765@qq.com");
			mailInfo.setMailSubject(subject);
			mailInfo.setMailContent(mailContent);
			// 这个类主要来发送邮件
			AndaSimpleMailSender.sendMailAsHtml(mailInfo);// 发送文体格式
		} catch (Exception e) {
			AndaLogger.recordLogger(e.getMessage());
		}
	}

	public static void sendMailToMemberAsText(String subject, String mailContent, String toMailAddress){
		try {
			// 这个类主要是设置邮件
			AndaMailSenderInfoBean mailInfo = new AndaMailSenderInfoBean();
			mailInfo.setMailServersHost("smtp.163.com");
			mailInfo.setMailServersPort("25");
			mailInfo.setValidate(true);
			mailInfo.setUserName("anda_notice@163.com");
			mailInfo.setSecurityWord("anda.notice");
			mailInfo.setFromMailAddress("anda_notice@163.com");
			mailInfo.setToMailAddress(toMailAddress);
			mailInfo.setMailSubject(subject);
			mailInfo.setMailContent(mailContent);
			// 这个类主要来发送邮件
			AndaSimpleMailSender.sendMailAsText(mailInfo);// 发送文体格式
		} catch (Exception e) {
			AndaLogger.recordLogger(e.getMessage());
		}
	}

	public static void sendMailToMemberAsHtml(String subject, String mailContent, String toMailAddress){
		try {
			// 这个类主要是设置邮件
			AndaMailSenderInfoBean mailInfo = new AndaMailSenderInfoBean();
			mailInfo.setMailServersHost("smtp.163.com");
			mailInfo.setMailServersPort("25");
			mailInfo.setValidate(true);
			mailInfo.setUserName("anda_notice@163.com");
			mailInfo.setSecurityWord("anda.notice");
			mailInfo.setFromMailAddress("anda_notice@163.com");
			mailInfo.setToMailAddress(toMailAddress);
			mailInfo.setMailSubject(subject);
			mailInfo.setMailContent(mailContent);
			// 这个类主要来发送邮件
			AndaSimpleMailSender.sendMailAsHtml(mailInfo);// 发送文体格式
		} catch (Exception e) {
			AndaLogger.recordLogger(e.getMessage());
		}
	}

}
